Script Editor allows you to create and edit a script, prepare and execute selected script. Drag-and-drop or double-click an identifier in the right Identifiers pane to add it to the editor.
Hint: Script will be automatically generated in Script Editor while you build in Find Builder or Aggregate Builder.
Navicat provides a wide range advanced features, such as compelling code editing capabilities, smart code-completion, script formatting, and more.
To change the script format, simply choose from the Format menu -
Indent
Increase/decrease indent for the selected lines of codes.
Comment
Comment/uncomment the selected lines of codes.
Beautify Script (Available only in Non-Essentials Edition)
Format the selected codes.
Code completion feature in Navicat pops up a list of suggestions as you type your script in the editor. It assists you with database names, collection names, view names, document field names and shell methods with their appropriate icons and information. You can update the code suggestions with latest database information by choosing Edit -> Code Completion -> Update Code Completion Info.
Code completion can be invoked by typing a dot (.), a character or pressing ESC.
When the suggestion list appears, press TAB to insert the first item. You can also select the needed item using UPPER ARROW or DOWN ARROW and then press TAB or ENTER.
If you select a snippet name from the list, the saved code will be inserted to the editor.
Hint: Resize the suggestion list by dragging the lower right corner.
You can enable or disable the code completion feature in Preferences.
Code folding feature enables you to collapse blocks of code such that only the first line of the block appears in Script Editor.
A block of code that can be folded is indicated by an icon
to the left of the first line of the block. A vertical line extends from the icon to the bottom of the foldable code. In contrast, a folded block of code is indicated by an icon
to left of the code block. You can fold the block by clicking
or expand it by clicking
.
Navicat supports to highlight the matching brace in the editor, i.e. () .
Note: The cursor must be on a brace to show the highlight.
Find
The Find bar is provided for quick searching for the text in the editor. Just simply choose Edit -> Find -> Find from the menu or press COMMAND-F, and then enter a search string.
Incremental searching is used here. As you type, the matched text is found and highlighted instantly. This saves your time from typing the entire text.
The search starts at the cursor's current position to the end of the file.
To find the previous or next occurrence, just simply click
or
.
Replace
To open the Replace bar, simply choose Edit -> Find -> Find and Replace from the menu bar or press OPTION-COMMAND-F. Then, enter the text you want to search and replace.
Click the Replace button to replace the first occurrence.
Click the Replace All button to replace all occurrences automatically.
There are some additional options for Find and Replace, click
:
Option |
Description |
Regular Expression |
Search regular expressions. |
Match Case |
Enable case sensitive search. |
Whole Words |
Return the objects that match the entire word of the search string. |
To copy the script with quotes, just simply control-click the highlighted script. Then, select Copy with quotes and choose the format.
In the Word Wrap mode, the horizontal scrollbar is removed. Script that exceed the width of the editor window size wraps to the next line. To enable Word Wrap, choose View -> Word Wrap.
Navicat has the ability to zoom in or zoom out the script in the editor. The zooming options are available from the View menu. The same effect can be achieved with keyboard shortcuts.
Zoom In: [COMMAND-+]
Zoom Out: [COMMAND--]
Reset: [COMMAND-0]
Note: Editors that are opened in different tabs or windows will not be effected by the zoom.